package com.ktjiaoyu.news.service.impl;

import com.ktjiaoyu.news.dao.PatientDao;
import com.ktjiaoyu.news.dao.impl.PatientDaoImpl;
import com.ktjiaoyu.news.entity.NewsAdmin;
import com.ktjiaoyu.news.entity.Patient;
import com.ktjiaoyu.news.service.PatinetService;
import com.ktjiaoyu.news.utils.Page;

import java.util.List;

public class PatinetServiceImpl implements PatinetService {
    PatientDao patientDao=new PatientDaoImpl();
    @Override
    public Page<Patient> findPage(Patient entity, int pageNo, int pageSize) {
        Page<Patient> page = new Page<>();
        // 获得总数量
        int count = patientDao.count();
        page.setPageNo(pageNo);
        page.setPageSize(pageSize);
        // 设置总数量，计算总页数
        page.setTotalCount(count);
        List<Patient> list = patientDao.getPage(entity, pageNo, pageSize);
        page.setData(list);
        return page;
    }
}
